#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
RUN sed -i 's/TLSv1.2/TLSv1/g' /etc/ssl/openssl.cnf
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["J.CustomerAPI/J.Customer.csproj", "J.CustomerAPI/"]
COPY ["CustomerService/CustomerService.csproj", "CustomerService/"]
COPY ["J.CustomerModel/J.CustomerModel.csproj", "J.CustomerModel/"]
COPY ["J.Repository/J.CustomerRepository.csproj", "J.Repository/"]
COPY ["StatusDto/StatusDto.csproj", "StatusDto/"]
RUN dotnet restore "J.CustomerAPI/J.Customer.csproj"
COPY . .
WORKDIR "/src/J.CustomerAPI"
RUN dotnet build "J.Customer.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "J.Customer.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "J.Customer.dll"]